/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package twitterWatchFollow;


/**
 *
 * @author yos
 */
public class TwitterWatchFollow {
    public static final double EPS=1.0E-9;
    public static String conf_xml="";
    public static xsd.xmlHandler<xjcConf.Root> m_confHandler;
    public static xsd.xmlHandler<xjcFollower.Root> m_followerHandler;
    public static final int m_maximum_friend_add = 1000;
    public static final int m_friends_count_min = 10;
    public static final int m_friends_count_max = 10000;
    public static final double m_friends_followers_ratio_min = 0.7;
    public static final double m_friends_followers_ratio_max = 2.0;
    public static final double m_rand_add_ratio_max=0.40;
    public static final double m_post_a_day_min=2.1;
    public static final double m_post_a_day_max=25.0;
    public static final double m_cumulative_days=7.0;
    public static boolean m_isInit=true;
    public static final int m_expire_days=30;
    public static final double m_act_destoroy_ffratio =1.1;
    //
    public static int m_total_retry_loop_count=0;
    /**
     * @param args the command line arguments
     */
    @SuppressWarnings("CallToThreadDumpStack")
    public static void main(String[] args) {
        preExecute();
        java.awt.EventQueue.invokeLater(new Runnable() {

            @Override
            public void run() {
                new WatchFollowJFrame().precheck();
            }
        });
    }
    
    private static void preExecute(){
        System.out.println("===== show system environment =====");
        System.out.printf("os: %s (Ver %s)\n",
                System.getProperty("os.name"),System.getProperty("os.version"));
        System.out.printf("language: %s (file-encoding %s)\n",
                System.getProperty("user.language"),System.getProperty("file.encoding"));
        System.out.printf("java %s (Ver %s)\n",
                System.getProperty("java.vendor"),System.getProperty("java.version"));
        System.out.printf("java-VM %s (%s Ver %s)\n",
                System.getProperty("java.vm.vendor"),System.getProperty("java.vm.name"),
                System.getProperty("java.vm.version"));
        System.out.println("currentDir: "+System.getProperty("user.dir"));
        System.out.println("homeDir   : "+System.getProperty("user.home"));
        //
        // initialize
        //
        System.out.println("===== initializing system configuration =====");
        conf_xml=System.getProperty("user.dir")+"\\src\\xml\\conf.xml";
        m_confHandler=new xsd.xmlHandler<>(conf_xml,"conf");
        if(!m_confHandler.execValidate()){
            System.out.println("ERR: xsd validate failed in "+conf_xml);
            System.exit(-1);
        }else{
            m_confHandler.unmarshaller();
        }
        //
        String follower_xml=System.getProperty("user.dir")+"\\src\\xml\\follower.xml";
        m_followerHandler=new xsd.xmlHandler<>(follower_xml,"follower");
        //m_followerHandler.setM_xmlOutputFilePath(follower_xml);
        if(!m_followerHandler.execValidate()){
            System.out.println("ERR: xsd validate failed in "+follower_xml);
            System.exit(-1);
        }else{
            m_followerHandler.unmarshaller();
        }
        
    }
    
}
